ALMaSS  1.0
The Animal, Landscape and Man Simulation System
AOR_Probe_Goose Class Reference

#include <AOR_Probe.h>

Inheritance diagram for AOR_Probe_Goose:
AOR_Probe

Public Member Functions

 AOR_Probe_Goose (Population_Manager *a_owner, Landscape *a_TheLandscape, string a_filename)
 
virtual void DoProbe (int a_lifestage)
 
- Public Member Functions inherited from AOR_Probe
 AOR_Probe (Population_Manager *a_owner, Landscape *a_TheLandscape, string a_filename)
 
virtual ~AOR_Probe ()
 
virtual void CloseFile ()
 
void WriteData ()
 

Additional Inherited Members

- Protected Attributes inherited from AOR_Probe
ofstream m_ProbeFile
 
int m_gridcountwidth [4]
 
int m_gridcountheight [4]
 
int m_gridcountsize [4]
 
int m_totalcells [4]
 
ListOfCells m_gridcount [4]
 
Landscapem_TheLandscape
 
Population_Managerm_owner
 

Constructor & Destructor Documentation

◆ AOR_Probe_Goose()

AOR_Probe_Goose::AOR_Probe_Goose ( Population_Manager a_owner,
Landscape a_TheLandscape,
string  a_filename 
)
80  : AOR_Probe( a_owner, a_TheLandscape, a_filename)
81 {
82  ;
83 }
AOR_Probe(Population_Manager *a_owner, Landscape *a_TheLandscape, string a_filename)
Definition: AOR_Probe.cpp:11

Member Function Documentation

◆ DoProbe()

void AOR_Probe_Goose::DoProbe ( int  a_lifestage)
virtual

Reimplemented from AOR_Probe.

86 {
87  Goose_Base* aGoose;
88  for (int grid = 0; grid < 4; grid++) {
89  // The line below may be the fastest way to fill a vector of ints with '0', but the one following is the safe way
90  // memset(&m_gridcount[grid][0], 0, m_gridcount[grid].size() * sizeof m_gridcount[grid][0]);
91  fill(m_gridcount[grid].begin(), m_gridcount[grid].end(), 0);
92  }
93  for (int groups = 0; groups < 2; groups++)
94  {
95  int gooseindex = a_goosespecies * 2 + groups;
96  unsigned int total = (unsigned)m_owner->GetLiveArraySize(gooseindex);
97  for (int grid = 0; grid < 4; grid++)
98  {
99  for (unsigned j = 0; j < total; j++)
100  {
101  aGoose = dynamic_cast<Goose_Base*>(m_owner->SupplyAnimalPtr(gooseindex, j));
102  if (aGoose->GetCurrentStateNo() != -1) {
103  APoint pt = aGoose->SupplyPoint();
104  int gx = pt.m_x / m_gridcountsize[grid];
105  int gy = pt.m_y / m_gridcountsize[grid];
106  m_gridcount[grid][gx + gy*m_gridcountwidth[grid]] += aGoose->GetGroupsize();
107  }
108  }
109  }
110  }
111  WriteData();
112 }
Population_Manager * m_owner
Definition: AOR_Probe.h:16
int m_gridcountsize[4]
Definition: AOR_Probe.h:11
int m_gridcountwidth[4]
Definition: AOR_Probe.h:9
void WriteData()
Definition: AOR_Probe.cpp:35
ListOfCells m_gridcount[4]
Definition: AOR_Probe.h:13
A simple class defining an x,y coordinate set.
Definition: ALMaSS_Setup.h:53
int m_y
Definition: ALMaSS_Setup.h:56
int m_x
Definition: ALMaSS_Setup.h:55
A class to describe the goose base.
Definition: Goose_Base.h:132
int GetGroupsize()
Returns the groupsize.
Definition: Goose_Base.h:410
TAnimal * SupplyAnimalPtr(int a_index, int a_animal)
Returns the pointer indexed by a_index and a_animal. Note NO RANGE CHECK.
Definition: PopulationManager.h:465
unsigned GetLiveArraySize(int a_listindex)
Gets the number of 'live' objects for a list index in the TheArray.
Definition: PopulationManager.h:433
int GetCurrentStateNo()
Returns the current state number.
Definition: PopulationManager.h:121
APoint SupplyPoint()
Definition: PopulationManager.h:209

References TALMaSSObject::GetCurrentStateNo(), Goose_Base::GetGroupsize(), Population_Manager::GetLiveArraySize(), AOR_Probe::m_gridcount, AOR_Probe::m_gridcountsize, AOR_Probe::m_gridcountwidth, AOR_Probe::m_owner, APoint::m_x, APoint::m_y, Population_Manager::SupplyAnimalPtr(), TAnimal::SupplyPoint(), and AOR_Probe::WriteData().

Referenced by Goose_Population_Manager::TheAOROutputProbe().


The documentation for this class was generated from the following files: